package sctu.edu.java.year2016.team08.chenruixiu.day20160521.chapter6_2;

/**前面介绍了去除字符串中所有空格的两种方法，试着不利用这两种方法，只利用for循环和if条件句实现去除空格
 * Created by Administrator on 2016/5/21.
 */
public class Two {
    public static void main(String[] args) {
        String s = new String("we are Chinese");

        for (int i = 0; i < s.length(); i++) {

            if (s.charAt(i) == ' ') {
                s = s.replace(" ", "");
                {
                }
                System.out.println(s);
            }

        }
    }
}

